package com.wc.alorithm_blue_bridge_history.fourteen.特殊日期;

/**
 * @Author congge
 * @Date 2024/1/15 19:38
 * @description 1.特殊日期
 * https://www.lanqiao.cn/problems/3495/learning/?page=1&first_category_id=1
 */
public class Main {

    static int[] month = new int[]{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    public static void main(String[] args) {
        int startYear = 2000;
        int endYear = 1999999;
        long ans = 0;
        for (int i = startYear; i <= endYear; i++) {
            if (isRun(i)) {
                month[2] = 29;
            } else {
                month[2] = 28;
            }
            for (int j = 1; j <= 12; j++) {
                if (i % j != 0) {
                    continue;
                }
                for (int k = 1; k <= month[j]; k++) {
                    if (i % k == 0) {
                        ans++;
                    }
                }
            }
        }
        // 最后一个2000000的1月1日,多一天
        ans++;
        System.out.println(ans);
    }

    static boolean isRun(int y) {
        return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
    }
}

